﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

/*
 * Image for Hell mode found at:
 * Tobas. Oh Crap Rage Face. Digital image. Know Your Meme. 
 * Cheezburger Inc, 2010. Web. 14 Nov. 2014. <http://knowyourmeme.com/memes/oh-crap-omg-rage-face>.
 * */

namespace CSE360_SudokuProject
{
    public partial class MainGameScreen16x16 : Form
    {
        //variables
        LogInMenu loginParent;
        PauseMenu thePause;
        public int currentSelectedNumber;
        Button highlightedInput;
        Button[,] cells = new Button[16, 16];
        Random helpButtonRandom = new Random();

        public MainGameScreen16x16(LogInMenu loginparent)
        {
            //intialize the form
            InitializeComponent();
            loginParent = loginparent;
            //sets inputs to nothing
            currentSelectedNumber = 0;
            highlightedInput = button1;
            //sets necessary data for 16x16 in MainGameInputClass
            MainGameInputClass.the16x16Board = this;
            MainGameInputClass.wrongAnswerCount = 0;
            MainGameInputClass.undoInfoArray[0].undoButton = null;
            MainGameInputClass.undoInfoArray[1].undoButton = null;
            MainGameInputClass.undoInfoArray[2].undoButton = null;

            Time.Text = string.Format("{0:00}:{1:00}", FileManager.currentTimeMinute, FileManager.currentTimeSecond);

            //method calls to load cells into array and data to board
            LoadCells();
            LoadData();
        }



        #region auxiliary button

        //
        //pause button
        //
        private void pausebutton_Click(object sender, EventArgs e)
        {
            //disables this form and hides it
            this.Enabled = false;
            this.Visible = false;
            //creates a pause form and shows it
            thePause = new PauseMenu(loginParent, null, this);
            thePause.Show();
            Timer.Enabled = false;
        }

        //
        // help button
        //
        private void helpbutton_Click(object sender, EventArgs e)
        {
            //checks that there is a wrong spot left in the puzzle
            //bit redundent but good safty mesure
            if (MainGameInputClass.wrongAnswerCount > 0)
            {
                //initalize i and j indexes
                int i = helpButtonRandom.Next(16);
                int j = helpButtonRandom.Next(16);

                //finds a cell that is wrong (non null button in wrong cell list)
                while (MainGameInputClass.wrongCellsList[i, j] == null)
                {
                    i = helpButtonRandom.Next(16);
                    j = helpButtonRandom.Next(16);
                }

                //removes the button from wrong list and count
                MainGameInputClass.wrongCellsList[i, j] = null;
                MainGameInputClass.wrongAnswerCount--;
                //updates for the undo
                MainGameInputClass.UpdateUndo(cells[i, j], i, j);
                //updates the board and current board data
                #region A-G characters switch

                string answerBoardText = "";
                //switch statement to deal with the A-G characters of 16x16
                switch (ThePuzzleGenerator.BoardAnswer16x16[i, j])
                {
                    case 10:
                        answerBoardText = "A";
                        break;
                    case 11:
                        answerBoardText = "B";
                        break;
                    case 12:
                        answerBoardText = "C";
                        break;
                    case 13:
                        answerBoardText = "D";
                        break;
                    case 14:
                        answerBoardText = "E";
                        break;
                    case 15:
                        answerBoardText = "F";
                        break;
                    case 16:
                        answerBoardText = "G";
                        break;
                    default:
                        answerBoardText = ThePuzzleGenerator.BoardAnswer16x16[i, j].ToString();
                        break;
                }
                #endregion
                cells[i, j].Text = answerBoardText;
                ThePuzzleGenerator.BoardCurrent16x16[i, j] = ThePuzzleGenerator.BoardAnswer16x16[i, j];
                //decrements the players score
                FileManager.currentScore -= 50;
                //checks if solution is reached      
            }
            //forces board to redraw board
            this.Refresh();

            //checks if the help fixed the last wrong cell
            if (MainGameInputClass.wrongAnswerCount <= 0)
            {                
                System.Threading.Thread.Sleep(1000);
                this.Close();
            }
        }

        //
        //undo button
        //
        private void undobutton_Click(object sender, EventArgs e)
        {
            // Calls undo button method in input class
            MainGameInputClass.UndoButton_Clicked();
        }
        #endregion

        #region Input Buttons
        //list of method calls to the input class to 
        //update the selected input button
        private void button1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(button1, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(button2, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(button3, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }

        private void button4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(button4, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }

        private void button5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(button5, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }

        private void button6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(button6, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }

        private void button7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(button7, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }

        private void button8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(button8, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }

        private void button9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(button9, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }

        private void button10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(button10, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }

        private void button11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(button11, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }

        private void button12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(button12, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }

        private void button13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(button13, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }

        private void button14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(button14, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }

        private void button15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(button15, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }

        private void button16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(button16, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }

        private void deletebutton_Click(object sender, EventArgs e)
        {
            MainGameInputClass.SelectButton(deletebutton, ref highlightedInput, ref currentSelectedNumber, DefaultBackColor);
        }
        #endregion

        #region Cells
        //list of methods that calls to the imput class when a cell is clicked
        //to input the selected number
        private void c1_1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c1_1, currentSelectedNumber, 0, 0);
        }

        private void c1_2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c1_2, currentSelectedNumber, 0, 1);
        }

        private void c1_3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c1_3, currentSelectedNumber, 0, 2);
        }

        private void c1_4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c1_4, currentSelectedNumber, 0, 3);
        }

        private void c1_5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c1_5, currentSelectedNumber, 1, 0);
        }

        private void c1_6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c1_6, currentSelectedNumber, 1, 1);
        }

        private void c1_7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c1_7, currentSelectedNumber, 1, 2);
        }

        private void c1_8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c1_8, currentSelectedNumber, 1, 3);
        }

        private void c1_9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c1_9, currentSelectedNumber, 2, 0);
        }

        private void c1_10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c1_10, currentSelectedNumber, 2, 1);
        }

        private void c1_11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c1_11, currentSelectedNumber, 2, 2);
        }

        private void c1_12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c1_12, currentSelectedNumber, 2, 3);
        }

        private void c1_13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c1_13, currentSelectedNumber, 3, 0);
        }

        private void c1_14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c1_14, currentSelectedNumber, 3, 1);
        }

        private void c1_15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c1_15, currentSelectedNumber, 3, 2);
        }

        private void c1_16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c1_16, currentSelectedNumber, 3, 3);
        }

        private void c2_1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c2_1, currentSelectedNumber, 0, 4);
        }

        private void c2_2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c2_2, currentSelectedNumber, 0, 5);
        }

        private void c2_3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c2_3, currentSelectedNumber, 0, 6);
        }

        private void c2_4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c2_4, currentSelectedNumber, 0, 7);
        }

        private void c2_5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c2_5, currentSelectedNumber, 1, 4);
        }

        private void c2_6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c2_6, currentSelectedNumber, 1, 5);
        }

        private void c2_7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c2_7, currentSelectedNumber, 1, 6);
        }

        private void c2_8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c2_8, currentSelectedNumber, 1, 7);
        }

        private void c2_9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c2_9, currentSelectedNumber, 2, 4);
        }

        private void c2_10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c2_10, currentSelectedNumber, 2, 5);
        }

        private void c2_11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c2_11, currentSelectedNumber, 2, 6);
        }

        private void c2_12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c2_12, currentSelectedNumber, 2, 7);
        }

        private void c2_13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c2_13, currentSelectedNumber, 3, 4);
        }

        private void c2_14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c2_14, currentSelectedNumber, 3, 5);
        }

        private void c2_15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c2_15, currentSelectedNumber, 3, 6);
        }

        private void c2_16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c2_16, currentSelectedNumber, 3, 7);
        }

        private void c3_1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c3_1, currentSelectedNumber, 0, 8);
        }

        private void c3_2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c3_2, currentSelectedNumber, 0, 9);
        }

        private void c3_3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c3_3, currentSelectedNumber, 0, 10);
        }

        private void c3_4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c3_4, currentSelectedNumber, 0, 11);
        }

        private void c3_5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c3_5, currentSelectedNumber, 1, 8);
        }

        private void c3_6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c3_6, currentSelectedNumber, 1, 9);
        }

        private void c3_7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c3_7, currentSelectedNumber, 1, 10);
        }

        private void c3_8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c3_8, currentSelectedNumber, 1, 11);
        }

        private void c3_9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c3_9, currentSelectedNumber, 2, 8);
        }

        private void c3_10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c3_10, currentSelectedNumber, 2, 9);
        }

        private void c3_11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c3_11, currentSelectedNumber, 2, 10);
        }

        private void c3_12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c3_12, currentSelectedNumber, 2, 11);
        }

        private void c3_13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c3_13, currentSelectedNumber, 3, 8);
        }

        private void c3_14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c3_14, currentSelectedNumber, 3, 9);
        }

        private void c3_15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c3_15, currentSelectedNumber, 3, 10);
        }

        private void c3_16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c3_16, currentSelectedNumber, 3, 11);
        }

        private void c4_1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c4_1, currentSelectedNumber, 0, 12);
        }

        private void c4_2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c4_2, currentSelectedNumber, 0, 13);
        }

        private void c4_3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c4_3, currentSelectedNumber, 0, 14);
        }

        private void c4_4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c4_4, currentSelectedNumber, 0, 15);
        }

        private void c4_5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c4_5, currentSelectedNumber, 1, 12);
        }

        private void c4_6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c4_6, currentSelectedNumber, 1, 13);
        }

        private void c4_7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c4_7, currentSelectedNumber, 1, 14);
        }

        private void c4_8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c4_8, currentSelectedNumber, 1, 15);
        }

        private void c4_9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c4_9, currentSelectedNumber, 2, 12);
        }

        private void c4_10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c4_10, currentSelectedNumber, 2, 13);
        }

        private void c4_11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c4_11, currentSelectedNumber, 2, 14);
        }

        private void c4_12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c4_12, currentSelectedNumber, 2, 15);
        }

        private void c4_13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c4_13, currentSelectedNumber, 3, 12);
        }

        private void c4_14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c4_14, currentSelectedNumber, 3, 13);
        }

        private void c4_15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c4_15, currentSelectedNumber, 3, 14);
        }

        private void c4_16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c4_16, currentSelectedNumber, 3, 15);
        }

        private void c5_1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c5_1, currentSelectedNumber, 4, 0);
        }

        private void c5_2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c5_2, currentSelectedNumber, 4, 1);
        }

        private void c5_3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c5_3, currentSelectedNumber, 4, 2);
        }

        private void c5_4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c5_4, currentSelectedNumber, 4, 3);
        }

        private void c5_5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c5_5, currentSelectedNumber, 5, 0);
        }

        private void c5_6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c5_6, currentSelectedNumber, 5, 1);
        }

        private void c5_7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c5_7, currentSelectedNumber, 5, 2);
        }

        private void c5_8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c5_8, currentSelectedNumber, 5, 3);
        }

        private void c5_9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c5_9, currentSelectedNumber, 6, 0);
        }

        private void c5_10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c5_10, currentSelectedNumber, 6, 1);
        }

        private void c5_11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c5_11, currentSelectedNumber, 6, 2);
        }

        private void c5_12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c5_12, currentSelectedNumber, 6, 3);
        }

        private void c5_13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c5_13, currentSelectedNumber, 7, 0);
        }

        private void c5_14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c5_14, currentSelectedNumber, 7, 1);
        }

        private void c5_15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c5_15, currentSelectedNumber, 7, 2);
        }

        private void c5_16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c5_16, currentSelectedNumber, 7, 3);
        }

        private void c6_1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c6_1, currentSelectedNumber, 4, 4);
        }

        private void c6_2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c6_2, currentSelectedNumber, 4, 5);
        }

        private void c6_3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c6_3, currentSelectedNumber, 4, 6);
        }

        private void c6_4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c6_4, currentSelectedNumber, 4, 7);
        }

        private void c6_5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c6_5, currentSelectedNumber, 5, 4);
        }

        private void c6_6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c6_6, currentSelectedNumber, 5, 5);
        }

        private void c6_7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c6_7, currentSelectedNumber, 5, 6);
        }

        private void c6_8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c6_8, currentSelectedNumber, 5, 7);
        }

        private void c6_9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c6_9, currentSelectedNumber, 6, 4);
        }

        private void c6_10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c6_10, currentSelectedNumber, 6, 5);
        }

        private void c6_11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c6_11, currentSelectedNumber, 6, 6);
        }

        private void c6_12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c6_12, currentSelectedNumber, 6, 7);
        }

        private void c6_13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c6_13, currentSelectedNumber, 7, 4);
        }

        private void c6_14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c6_14, currentSelectedNumber, 7, 5);
        }

        private void c6_15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c6_15, currentSelectedNumber, 7, 6);
        }

        private void c6_16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c6_16, currentSelectedNumber, 7, 7);
        }

        private void c7_1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c7_1, currentSelectedNumber, 4, 8);
        }

        private void c7_2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c7_2, currentSelectedNumber, 4, 9);
        }

        private void c7_3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c7_3, currentSelectedNumber, 4, 10);
        }

        private void c7_4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c7_4, currentSelectedNumber, 4, 11);
        }

        private void c7_5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c7_5, currentSelectedNumber, 5, 8);
        }

        private void c7_6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c7_6, currentSelectedNumber, 5, 9);
        }

        private void c7_7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c7_7, currentSelectedNumber, 5, 10);
        }

        private void c7_8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c7_8, currentSelectedNumber, 5, 11);
        }

        private void c7_9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c7_9, currentSelectedNumber, 6, 8);
        }

        private void c7_10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c7_10, currentSelectedNumber, 6, 9);
        }

        private void c7_11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c7_11, currentSelectedNumber, 6, 10);
        }

        private void c7_12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c7_12, currentSelectedNumber, 6, 11);
        }

        private void c7_13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c7_13, currentSelectedNumber, 7, 8);
        }

        private void c7_14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c7_14, currentSelectedNumber, 7, 9);
        }

        private void c7_15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c7_15, currentSelectedNumber, 7, 10);
        }

        private void c7_16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c7_16, currentSelectedNumber, 7, 11);
        }

        private void c8_1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c8_1, currentSelectedNumber, 4, 12);
        }

        private void c8_2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c8_2, currentSelectedNumber, 4, 13);
        }

        private void c8_3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c8_3, currentSelectedNumber, 4, 14);
        }

        private void c8_4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c8_4, currentSelectedNumber, 4, 15);
        }

        private void c8_5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c8_5, currentSelectedNumber, 5, 12);
        }

        private void c8_6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c8_6, currentSelectedNumber, 5, 13);
        }

        private void c8_7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c8_7, currentSelectedNumber, 5, 14);
        }

        private void c8_8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c8_8, currentSelectedNumber, 5, 15);
        }

        private void c8_9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c8_9, currentSelectedNumber, 6, 12);
        }

        private void c8_10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c8_10, currentSelectedNumber, 6, 13);
        }

        private void c8_11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c8_11, currentSelectedNumber, 6, 14);
        }

        private void c8_12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c8_12, currentSelectedNumber, 6, 15);
        }

        private void c8_13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c8_13, currentSelectedNumber, 7, 12);
        }

        private void c8_14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c8_14, currentSelectedNumber, 7, 13);
        }

        private void c8_15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c8_15, currentSelectedNumber, 7, 14);
        }

        private void c8_16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c8_16, currentSelectedNumber, 7, 15);
        }

        private void c9_1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c9_1, currentSelectedNumber, 8, 0);
        }

        private void c9_2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c9_2, currentSelectedNumber, 8, 1);
        }

        private void c9_3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c9_3, currentSelectedNumber, 8, 2);
        }

        private void c9_4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c9_4, currentSelectedNumber, 8, 3);
        }

        private void c9_5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c9_5, currentSelectedNumber, 9, 0);
        }

        private void c9_6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c9_6, currentSelectedNumber, 9, 1);
        }

        private void c9_7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c9_7, currentSelectedNumber, 9, 2);
        }

        private void c9_8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c9_8, currentSelectedNumber, 9, 3);
        }

        private void c9_9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c9_9, currentSelectedNumber, 10, 0);
        }

        private void c9_10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c9_10, currentSelectedNumber, 10, 1);
        }

        private void c9_11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c9_11, currentSelectedNumber, 10, 2);
        }

        private void c9_12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c9_12, currentSelectedNumber, 10, 3);
        }

        private void c9_13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c9_13, currentSelectedNumber, 11, 0);
        }

        private void c9_14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c9_14, currentSelectedNumber, 11, 1);
        }

        private void c9_15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c9_15, currentSelectedNumber, 11, 2);
        }

        private void c9_16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c9_16, currentSelectedNumber, 11, 3);
        }

        private void c10_1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c10_1, currentSelectedNumber, 8, 4);
        }

        private void c10_2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c10_2, currentSelectedNumber, 8, 5);
        }

        private void c10_3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c10_3, currentSelectedNumber, 8, 6);
        }

        private void c10_4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c10_4, currentSelectedNumber, 8, 7);
        }

        private void c10_5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c10_5, currentSelectedNumber, 9, 4);
        }

        private void c10_6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c10_6, currentSelectedNumber, 9, 5);
        }

        private void c10_7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c10_7, currentSelectedNumber, 9, 6);
        }

        private void c10_8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c10_8, currentSelectedNumber, 9, 7);
        }

        private void c10_9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c10_9, currentSelectedNumber, 10, 4);
        }

        private void c10_10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c10_10, currentSelectedNumber, 10, 5);
        }

        private void c10_11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c10_11, currentSelectedNumber, 10, 6);
        }

        private void c10_12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c10_12, currentSelectedNumber, 10, 7);
        }

        private void c10_13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c10_13, currentSelectedNumber, 11, 4);
        }

        private void c10_14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c10_14, currentSelectedNumber, 11, 5);
        }

        private void c10_15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c10_15, currentSelectedNumber, 11, 6);
        }

        private void c10_16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c10_16, currentSelectedNumber, 11, 7);
        }

        private void c11_1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c11_1, currentSelectedNumber, 8, 8);
        }

        private void c11_2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c11_2, currentSelectedNumber, 8, 9);
        }

        private void c11_3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c11_3, currentSelectedNumber, 8, 10);
        }

        private void c11_4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c11_4, currentSelectedNumber, 8, 11);
        }

        private void c11_5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c11_5, currentSelectedNumber, 9, 8);
        }

        private void c11_6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c11_6, currentSelectedNumber, 9, 9);
        }

        private void c11_7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c11_7, currentSelectedNumber, 9, 10);
        }

        private void c11_8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c11_8, currentSelectedNumber, 9, 11);
        }

        private void c11_9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c11_9, currentSelectedNumber, 10, 8);
        }

        private void c11_10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c11_10, currentSelectedNumber, 10, 9);
        }

        private void c11_11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c11_11, currentSelectedNumber, 10, 10);
        }

        private void c11_12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c11_12, currentSelectedNumber, 10, 11);
        }

        private void c11_13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c11_13, currentSelectedNumber, 11, 8);
        }

        private void c11_14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c11_14, currentSelectedNumber, 11, 9);
        }

        private void c11_15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c11_15, currentSelectedNumber, 11, 10);
        }

        private void c11_16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c11_16, currentSelectedNumber, 11, 11);
        }

        private void c12_1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c12_1, currentSelectedNumber, 8, 12);
        }

        private void c12_2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c12_2, currentSelectedNumber, 8, 13);
        }

        private void c12_3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c12_3, currentSelectedNumber, 8, 14);
        }

        private void c12_4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c12_4, currentSelectedNumber, 8, 15);
        }

        private void c12_5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c12_5, currentSelectedNumber, 9, 12);
        }

        private void c12_6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c12_6, currentSelectedNumber, 9, 13);
        }

        private void c12_7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c12_7, currentSelectedNumber, 9, 14);
        }

        private void c12_8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c12_8, currentSelectedNumber, 9, 15);
        }

        private void c12_9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c12_9, currentSelectedNumber, 10, 12);
        }

        private void c12_10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c12_10, currentSelectedNumber, 10, 13);
        }

        private void c12_11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c12_11, currentSelectedNumber, 10, 14);
        }

        private void c12_12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c12_12, currentSelectedNumber, 10, 15);
        }

        private void c12_13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c12_13, currentSelectedNumber, 11, 12);
        }

        private void c12_14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c12_14, currentSelectedNumber, 11, 13);
        }

        private void c12_15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c12_15, currentSelectedNumber, 11, 14);
        }

        private void c12_16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c12_16, currentSelectedNumber, 11, 15);
        }

        private void c13_1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c13_1, currentSelectedNumber, 12, 0);
        }

        private void c13_2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c13_2, currentSelectedNumber, 12, 1);
        }

        private void c13_3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c13_3, currentSelectedNumber, 12, 2);
        }

        private void c13_4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c13_4, currentSelectedNumber, 12, 3);
        }

        private void c13_5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c13_5, currentSelectedNumber, 13, 0);
        }

        private void c13_6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c13_6, currentSelectedNumber, 13, 1);
        }

        private void c13_7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c13_7, currentSelectedNumber, 13, 2);
        }

        private void c13_8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c13_8, currentSelectedNumber, 13, 3);
        }

        private void c13_9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c13_9, currentSelectedNumber, 14, 0);
        }

        private void c13_10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c13_10, currentSelectedNumber, 14, 1);
        }

        private void c13_11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c13_11, currentSelectedNumber, 14, 2);
        }

        private void c13_12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c13_12, currentSelectedNumber, 14, 3);
        }

        private void c13_13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c13_13, currentSelectedNumber, 15, 0);
        }

        private void c13_14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c13_14, currentSelectedNumber, 15, 1);
        }

        private void c13_15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c13_15, currentSelectedNumber, 15, 2);
        }

        private void c13_16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c13_16, currentSelectedNumber, 15, 3);
        }

        private void c14_1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c14_1, currentSelectedNumber, 12, 4);
        }

        private void c14_2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c14_2, currentSelectedNumber, 12, 5);
        }

        private void c14_3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c14_3, currentSelectedNumber, 12, 6);
        }

        private void c14_4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c14_4, currentSelectedNumber, 12, 7);
        }

        private void c14_5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c14_5, currentSelectedNumber, 13, 4);
        }

        private void c14_6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c14_6, currentSelectedNumber, 13, 5);
        }

        private void c14_7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c14_7, currentSelectedNumber, 13, 6);
        }

        private void c14_8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c14_8, currentSelectedNumber, 13, 7);
        }

        private void c14_9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c14_9, currentSelectedNumber, 14, 4);
        }

        private void c14_10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c14_10, currentSelectedNumber, 14, 5);
        }

        private void c14_11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c14_11, currentSelectedNumber, 14, 6);
        }

        private void c14_12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c14_12, currentSelectedNumber, 14, 7);
        }

        private void c14_13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c14_13, currentSelectedNumber, 15, 4);
        }

        private void c14_14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c14_14, currentSelectedNumber, 15, 5);
        }

        private void c14_15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c14_15, currentSelectedNumber, 15, 6);
        }

        private void c14_16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c14_16, currentSelectedNumber, 15, 7);
        }

        private void c15_1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c15_1, currentSelectedNumber, 12, 8);
        }

        private void c15_2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c15_2, currentSelectedNumber, 12, 9);
        }

        private void c15_3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c15_3, currentSelectedNumber, 12, 10);
        }

        private void c15_4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c15_4, currentSelectedNumber, 12, 11);
        }

        private void c15_5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c15_5, currentSelectedNumber, 13, 8);
        }

        private void c15_6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c15_6, currentSelectedNumber, 13, 9);
        }

        private void c15_7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c15_7, currentSelectedNumber, 13, 10);
        }

        private void c15_8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c15_8, currentSelectedNumber, 13, 11);
        }

        private void c15_9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c15_9, currentSelectedNumber, 14, 8);
        }

        private void c15_10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c15_10, currentSelectedNumber, 14, 9);
        }

        private void c15_11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c15_11, currentSelectedNumber, 14, 10);
        }

        private void c15_12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c15_12, currentSelectedNumber, 14, 11);
        }

        private void c15_13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c15_13, currentSelectedNumber, 15, 8);
        }

        private void c15_14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c15_14, currentSelectedNumber, 15, 9);
        }

        private void c15_15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c15_15, currentSelectedNumber, 15, 10);
        }

        private void c15_16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c15_16, currentSelectedNumber, 15, 11);
        }

        private void c16_1_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c16_1, currentSelectedNumber, 12, 12);
        }

        private void c16_2_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c16_2, currentSelectedNumber, 12, 13);
        }

        private void c16_3_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c16_3, currentSelectedNumber, 12, 14);
        }

        private void c16_4_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c16_4, currentSelectedNumber, 12, 15);
        }

        private void c16_5_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c16_5, currentSelectedNumber, 13, 12);
        }

        private void c16_6_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c16_6, currentSelectedNumber, 13, 13);
        }

        private void c16_7_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c16_7, currentSelectedNumber, 13, 14);
        }

        private void c16_8_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c16_8, currentSelectedNumber, 13, 15);
        }

        private void c16_9_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c16_9, currentSelectedNumber, 14, 12);
        }

        private void c16_10_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c16_10, currentSelectedNumber, 14, 13);
        }

        private void c16_11_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c16_11, currentSelectedNumber, 14, 14);
        }

        private void c16_12_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c16_12, currentSelectedNumber, 14, 15);
        }

        private void c16_13_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c16_13, currentSelectedNumber, 15, 12);
        }

        private void c16_14_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c16_14, currentSelectedNumber, 15, 13);
        }

        private void c16_15_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c16_15, currentSelectedNumber, 15, 14);
        }

        private void c16_16_Click(object sender, EventArgs e)
        {
            MainGameInputClass.InputAnswer(c16_16, currentSelectedNumber, 15, 15);
        }
        #endregion

        #region load cells (buttons) into a array and then populates the board

        //loads cells into array
        private void LoadCells()
        {
            cells[0, 0] = c1_1;
            cells[0, 1] = c1_2;
            cells[0, 2] = c1_3;
            cells[0, 3] = c1_4;
            cells[1, 0] = c1_5;
            cells[1, 1] = c1_6;
            cells[1, 2] = c1_7;
            cells[1, 3] = c1_8;
            cells[2, 0] = c1_9;
            cells[2, 1] = c1_10;
            cells[2, 2] = c1_11;
            cells[2, 3] = c1_12;
            cells[3, 0] = c1_13;
            cells[3, 1] = c1_14;
            cells[3, 2] = c1_15;
            cells[3, 3] = c1_16;

            cells[0, 4] = c2_1;
            cells[0, 5] = c2_2;
            cells[0, 6] = c2_3;
            cells[0, 7] = c2_4;
            cells[1, 4] = c2_5;
            cells[1, 5] = c2_6;
            cells[1, 6] = c2_7;
            cells[1, 7] = c2_8;
            cells[2, 4] = c2_9;
            cells[2, 5] = c2_10;
            cells[2, 6] = c2_11;
            cells[2, 7] = c2_12;
            cells[3, 4] = c2_13;
            cells[3, 5] = c2_14;
            cells[3, 6] = c2_15;
            cells[3, 7] = c2_16;

            cells[0, 8] = c3_1;
            cells[0, 9] = c3_2;
            cells[0, 10] = c3_3;
            cells[0, 11] = c3_4;
            cells[1, 8] = c3_5;
            cells[1, 9] = c3_6;
            cells[1, 10] = c3_7;
            cells[1, 11] = c3_8;
            cells[2, 8] = c3_9;
            cells[2, 9] = c3_10;
            cells[2, 10] = c3_11;
            cells[2, 11] = c3_12;
            cells[3, 8] = c3_13;
            cells[3, 9] = c3_14;
            cells[3, 10] = c3_15;
            cells[3, 11] = c3_16;

            cells[0, 12] = c4_1;
            cells[0, 13] = c4_2;
            cells[0, 14] = c4_3;
            cells[0, 15] = c4_4;
            cells[1, 12] = c4_5;
            cells[1, 13] = c4_6;
            cells[1, 14] = c4_7;
            cells[1, 15] = c4_8;
            cells[2, 12] = c4_9;
            cells[2, 13] = c4_10;
            cells[2, 14] = c4_11;
            cells[2, 15] = c4_12;
            cells[3, 12] = c4_13;
            cells[3, 13] = c4_14;
            cells[3, 14] = c4_15;
            cells[3, 15] = c4_16;

            cells[4, 0] = c5_1;
            cells[4, 1] = c5_2;
            cells[4, 2] = c5_3;
            cells[4, 3] = c5_4;
            cells[5, 0] = c5_5;
            cells[5, 1] = c5_6;
            cells[5, 2] = c5_7;
            cells[5, 3] = c5_8;
            cells[6, 0] = c5_9;
            cells[6, 1] = c5_10;
            cells[6, 2] = c5_11;
            cells[6, 3] = c5_12;
            cells[7, 0] = c5_13;
            cells[7, 1] = c5_14;
            cells[7, 2] = c5_15;
            cells[7, 3] = c5_16;

            cells[4, 4] = c6_1;
            cells[4, 5] = c6_2;
            cells[4, 6] = c6_3;
            cells[4, 7] = c6_4;
            cells[5, 4] = c6_5;
            cells[5, 5] = c6_6;
            cells[5, 6] = c6_7;
            cells[5, 7] = c6_8;
            cells[6, 4] = c6_9;
            cells[6, 5] = c6_10;
            cells[6, 6] = c6_11;
            cells[6, 7] = c6_12;
            cells[7, 4] = c6_13;
            cells[7, 5] = c6_14;
            cells[7, 6] = c6_15;
            cells[7, 7] = c6_16;

            cells[4, 8] = c7_1;
            cells[4, 9] = c7_2;
            cells[4, 10] = c7_3;
            cells[4, 11] = c7_4;
            cells[5, 8] = c7_5;
            cells[5, 9] = c7_6;
            cells[5, 10] = c7_7;
            cells[5, 11] = c7_8;
            cells[6, 8] = c7_9;
            cells[6, 9] = c7_10;
            cells[6, 10] = c7_11;
            cells[6, 11] = c7_12;
            cells[7, 8] = c7_13;
            cells[7, 9] = c7_14;
            cells[7, 10] = c7_15;
            cells[7, 11] = c7_16;

            cells[4, 12] = c8_1;
            cells[4, 13] = c8_2;
            cells[4, 14] = c8_3;
            cells[4, 15] = c8_4;
            cells[5, 12] = c8_5;
            cells[5, 13] = c8_6;
            cells[5, 14] = c8_7;
            cells[5, 15] = c8_8;
            cells[6, 12] = c8_9;
            cells[6, 13] = c8_10;
            cells[6, 14] = c8_11;
            cells[6, 15] = c8_12;
            cells[7, 12] = c8_13;
            cells[7, 13] = c8_14;
            cells[7, 14] = c8_15;
            cells[7, 15] = c8_16;

            cells[8, 0] = c9_1;
            cells[8, 1] = c9_2;
            cells[8, 2] = c9_3;
            cells[8, 3] = c9_4;
            cells[9, 0] = c9_5;
            cells[9, 1] = c9_6;
            cells[9, 2] = c9_7;
            cells[9, 3] = c9_8;
            cells[10, 0] = c9_9;
            cells[10, 1] = c9_10;
            cells[10, 2] = c9_11;
            cells[10, 3] = c9_12;
            cells[11, 0] = c9_13;
            cells[11, 1] = c9_14;
            cells[11, 2] = c9_15;
            cells[11, 3] = c9_16;

            cells[8, 4] = c10_1;
            cells[8, 5] = c10_2;
            cells[8, 6] = c10_3;
            cells[8, 7] = c10_4;
            cells[9, 4] = c10_5;
            cells[9, 5] = c10_6;
            cells[9, 6] = c10_7;
            cells[9, 7] = c10_8;
            cells[10, 4] = c10_9;
            cells[10, 5] = c10_10;
            cells[10, 6] = c10_11;
            cells[10, 7] = c10_12;
            cells[11, 4] = c10_13;
            cells[11, 5] = c10_14;
            cells[11, 6] = c10_15;
            cells[11, 7] = c10_16;

            cells[8, 8] = c11_1;
            cells[8, 9] = c11_2;
            cells[8, 10] = c11_3;
            cells[8, 11] = c11_4;
            cells[9, 8] = c11_5;
            cells[9, 9] = c11_6;
            cells[9, 10] = c11_7;
            cells[9, 11] = c11_8;
            cells[10, 8] = c11_9;
            cells[10, 9] = c11_10;
            cells[10, 10] = c11_11;
            cells[10, 11] = c11_12;
            cells[11, 8] = c11_13;
            cells[11, 9] = c11_14;
            cells[11, 10] = c11_15;
            cells[11, 11] = c11_16;

            cells[8, 12] = c12_1;
            cells[8, 13] = c12_2;
            cells[8, 14] = c12_3;
            cells[8, 15] = c12_4;
            cells[9, 12] = c12_5;
            cells[9, 13] = c12_6;
            cells[9, 14] = c12_7;
            cells[9, 15] = c12_8;
            cells[10, 12] = c12_9;
            cells[10, 13] = c12_10;
            cells[10, 14] = c12_11;
            cells[10, 15] = c12_12;
            cells[11, 12] = c12_13;
            cells[11, 13] = c12_14;
            cells[11, 14] = c12_15;
            cells[11, 15] = c12_16;

            cells[12, 0] = c13_1;
            cells[12, 1] = c13_2;
            cells[12, 2] = c13_3;
            cells[12, 3] = c13_4;
            cells[13, 0] = c13_5;
            cells[13, 1] = c13_6;
            cells[13, 2] = c13_7;
            cells[13, 3] = c13_8;
            cells[14, 0] = c13_9;
            cells[14, 1] = c13_10;
            cells[14, 2] = c13_11;
            cells[14, 3] = c13_12;
            cells[15, 0] = c13_13;
            cells[15, 1] = c13_14;
            cells[15, 2] = c13_15;
            cells[15, 3] = c13_16;

            cells[12, 4] = c14_1;
            cells[12, 5] = c14_2;
            cells[12, 6] = c14_3;
            cells[12, 7] = c14_4;
            cells[13, 4] = c14_5;
            cells[13, 5] = c14_6;
            cells[13, 6] = c14_7;
            cells[13, 7] = c14_8;
            cells[14, 4] = c14_9;
            cells[14, 5] = c14_10;
            cells[14, 6] = c14_11;
            cells[14, 7] = c14_12;
            cells[15, 4] = c14_13;
            cells[15, 5] = c14_14;
            cells[15, 6] = c14_15;
            cells[15, 7] = c14_16;

            cells[12, 8] = c15_1;
            cells[12, 9] = c15_2;
            cells[12, 10] = c15_3;
            cells[12, 11] = c15_4;
            cells[13, 8] = c15_5;
            cells[13, 9] = c15_6;
            cells[13, 10] = c15_7;
            cells[13, 11] = c15_8;
            cells[14, 8] = c15_9;
            cells[14, 9] = c15_10;
            cells[14, 10] = c15_11;
            cells[14, 11] = c15_12;
            cells[15, 8] = c15_13;
            cells[15, 9] = c15_14;
            cells[15, 10] = c15_15;
            cells[15, 11] = c15_16;

            cells[12, 12] = c16_1;
            cells[12, 13] = c16_2;
            cells[12, 14] = c16_3;
            cells[12, 15] = c16_4;
            cells[13, 12] = c16_5;
            cells[13, 13] = c16_6;
            cells[13, 14] = c16_7;
            cells[13, 15] = c16_8;
            cells[14, 12] = c16_9;
            cells[14, 13] = c16_10;
            cells[14, 14] = c16_11;
            cells[14, 15] = c16_12;
            cells[15, 12] = c16_13;
            cells[15, 13] = c16_14;
            cells[15, 14] = c16_15;
            cells[15, 15] = c16_16;
        }


        //loads the data to the board
        public void LoadData()
        {
            for (int i = 0; i < 16; i++)
                for (int j = 0; j < 16; j++)
                {
                    //checks if the current board spot is not empty
                    if (ThePuzzleGenerator.BoardCurrent16x16[i, j] != 0)
                    {
                        //changes button text to match stored data
                        switch (ThePuzzleGenerator.BoardCurrent16x16[i, j])
                        {
                            case 10:
                                cells[i, j].Text = "A";
                                break;
                            case 11:
                                cells[i, j].Text = "B";
                                break;
                            case 12:
                                cells[i, j].Text = "C";
                                break;
                            case 13:
                                cells[i, j].Text = "D";
                                break;
                            case 14:
                                cells[i, j].Text = "E";
                                break;
                            case 15:
                                cells[i, j].Text = "F";
                                break;
                            case 16:
                                cells[i, j].Text = "G";
                                break;
                            default:
                                cells[i, j].Text = ThePuzzleGenerator.BoardCurrent16x16[i, j].ToString();
                                break;
                        }
                    }
                    else
                        cells[i, j].Text = "";

                    //checks if data was orignially generated 
                    //if so disables button and greys it out  
                    if (ThePuzzleGenerator.BoardInitial16x16[i, j] != 0)
                    {
                        switch (ThePuzzleGenerator.BoardInitial16x16[i, j])
                        {
                            case 10:
                                cells[i, j].Text = "A";
                                break;
                            case 11:
                                cells[i, j].Text = "B";
                                break;
                            case 12:
                                cells[i, j].Text = "C";
                                break;
                            case 13:
                                cells[i, j].Text = "D";
                                break;
                            case 14:
                                cells[i, j].Text = "E";
                                break;
                            case 15:
                                cells[i, j].Text = "F";
                                break;
                            case 16:
                                cells[i, j].Text = "G";
                                break;
                            default:
                                cells[i, j].Text = ThePuzzleGenerator.BoardInitial16x16[i, j].ToString();
                                break;
                        }                       
                        ThePuzzleGenerator.BoardCurrent16x16[i, j] = ThePuzzleGenerator.BoardInitial16x16[i, j];
                        cells[i, j].Enabled = false;
                        cells[i, j].BackColor = Color.LightGray;
                    }

                    //checks if the current spot matches the answer 
                    //if not places into array and counter for trancking completeness 
                    //and for help button
                    if (ThePuzzleGenerator.BoardCurrent16x16[i, j].CompareTo
                            (ThePuzzleGenerator.BoardAnswer16x16[i, j]) != 0)
                    {
                        MainGameInputClass.wrongCellsList[i, j] = cells[i, j];
                        MainGameInputClass.wrongAnswerCount++;
                    }
                }
        }
        #endregion

        #region form close events
        private void MainGameScreen16x16_FormClosing(object sender, FormClosingEventArgs e)
        {
            //saves the data if the board isn't complete and wipes it if it is complete
            if (MainGameInputClass.wrongAnswerCount <= 0)
            {
                ThePuzzleGenerator.BoardAnswer16x16 = null;
                ThePuzzleGenerator.BoardInitial16x16 = null;
                ThePuzzleGenerator.BoardCurrent16x16 = null;
                FileManager.youWon = true;               
            }
            Timer.Enabled = false;
            FileManager.SaveData();
        }

        private void MainGameScreen16x16_FormClosed(object sender, FormClosedEventArgs e)
        {
            //creates main menu form and sends it the loginparent
            //login parent is login form which is the main form
            MainMenu theMainMenu = new MainMenu(loginParent);
            theMainMenu.Show();
        }
        #endregion

        private void Timer_Tick(object sender, EventArgs e)
        {
            //uses timer tick event to update time and display it
            FileManager.currentTimeSecond++;
            if (FileManager.currentTimeSecond == 60)
            {
                FileManager.currentTimeMinute++;
                FileManager.currentTimeSecond = 0;
            }
            Time.Text = string.Format("{0:00}:{1:00}", FileManager.currentTimeMinute, FileManager.currentTimeSecond);
            this.Refresh();
        }

        private void merceyreturn_Click(object sender, EventArgs e)
        {
            //when the mercy button is clicked return to mainmenu
            this.Close();
        }
    }
}
